package temp.lho.lws.service.impl;

import org.springframework.transaction.annotation.Transactional;
import temp.lho.lws.mapper.IBaseMapper;
import temp.lho.lws.service.IBaseService;

import java.util.List;

/**
 * @author liuws
 * @create 2020-06-24 18:14
 */
@Transactional
public abstract class BaseServiceImpl<T> implements IBaseService<T> {

    protected abstract IBaseMapper<T> baseMapper();

    @Override
    public int add(T t) {
        return baseMapper().add(t);
    }

    @Override
    public int delete(Integer id) {
        return baseMapper().delete(id);
    }

    @Override
    public int update(T t) {
        return baseMapper().update(t);
    }

    @Override
    public List<T> findAll() {
        return baseMapper().findAll();
    }

    @Override
    public T findById(Integer id) {
        return baseMapper().findById(id);
    }
}
